package common
import(
    "gopkg.in/yaml.v2"
    "fmt"
)

func InArray(o string, a []string) bool{
	for _, v := range a{
		if v == o {
			return true
		}
	}
	return false
}

func ToYaml[T any](obj T) string{
	// 将结构体转换为YAML
    y, err := yaml.Marshal(&obj)
    if err != nil {
        fmt.Printf("=====Marshal error: %v", err)
        return ""
    }
    if y == nil {
        return ""
    }
    return string(y)
}
